package com.atguigu.exam;

/**
 * @author xbd
 * @create 2021-05-25 17:14
 */
public class StringTest {
    public static void main(String[] args) {
        String str1 = "尚硅谷";
        String str2 = "尚硅谷";
        String str3 = new String("尚硅谷");
        System.out.println(str1 == str2);//true
        System.out.println(str1 == str3);//false
        System.out.println(str1.equals(str3));//true
        str1 = "尚硅谷atguigu.com";
        String str4 = "atguigu.com";
        String str5 = "尚硅谷" + "atguigu.com";
        System.out.println(str1 == str5);//true

        String str6 = (str2 + str4).intern();
        System.out.println(str1 == str6);//false  ---->true
    }
}
